<template>
  <div class="paihangbang">
    <Navi title="必听" />

    <div class="bbox">
      <div class="btitle">必听列表</div>

      <div class="blist">

        <div class="lbox" v-for="(item,index) in pt" :key="index" @click="viewAudio(item.id)">
          <div class="limg">
            <img
              class="auto-img"
              :src="url+item.albumInfo.cover"
              alt=""
            />
          </div>
          <div class="ltext">{{item.albumInfo.title}}</div>
          <div class="lxiang">
            <span class="jian">介绍:</span
            ><span class="jie">{{item.albumInfo.customTitle==='' ? '糗事播报 | 经典段子' : item.albumInfo.customTitle}}</span>
          </div>
        </div>

      </div>
    </div>
  </div>
</template>

<script>
import Navi from "../components/Navi.vue";
export default {
  name: "Paihangbang",
  components: {
    Navi
  },
  data(){
      return{
          pt:[],
          url:'https://imagev2.xmcdn.com/'
      }
  },
  created() {
      this.getPai();
  },
  methods: {
    getPai() {
      this.axios({
        method: "get",
        url:"https://apis.netstart.cn/ximalaya/album/queryClassicListenAlbums",
      })
        .then((result) => {
            this.$toast('加载完成');
            result.data.data.forEach(v=>{
            this.pt.push(v)
          })
        })
        .catch((err) => {
          
        });
    },
    viewAudio(trackid){
      this.$router.push({name:'Audio',params:{trackid}})
    }
  },
};
</script>

<style lang="less" scoped>
.bbox {
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  .btitle {
    width: 100%;
    padding: 5px 0;
    margin: 0 auto;
    text-align: center;
    font-size: 20px;
    color: #333;
    border-bottom: 1px solid #ddd;
  }
  .blist {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 15px 10px;
    box-sizing: border-box;
    flex-wrap: wrap;
    .lbox {
      width: 49%;
      margin-bottom: 15px;
      padding: 10px;
      box-sizing: border-box;
      background-color: #fff;
      border-radius: 10px;
      .limg {
        width: 110px;
        height: 110px;
        margin: 0 auto;
      }
      .ltext {
        color: #333;
        font-size: 14px;
        margin: 5px 0;
        font-weight: bold;
        text-overflow: ellipsis;
        overflow: hidden;
        text-align: center;
        white-space: nowrap;
      }
      .jian {
        color: #333;
        font-size: 13px;
      }
      .jie {
        color: #333;
        font-size: 12px;
        margin-top: 3px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
    }
  }
}
</style>